package mysql

import (
	"gorm.io/gorm"
	"homefinder/homefinderrpc/homefinderrpc"
)

type Home struct {
	gorm.Model
	Title   string `gorm:"type:varchar(30);comment:标题"`
	Image   string `gorm:"type:varchar(30);comment:图片"`
	Address string `gorm:"type:varchar(30);comment:地址"`
}

func ListHome(db *gorm.DB) ([]*homefinderrpc.HomeList, error) {
	var list []*homefinderrpc.HomeList
	err2 := db.Debug().Model(&Home{}).Select(
		"title",
		"image",
		"address",
	).Find(&list).Error
	return list, err2
}
